/*******************************************************************************
 * @project: CDMS_12
 * @package: com.esoon.cdms.model
 * @file: ProjectListModel.java
 * @author: Administrator
 * @created: 2017-6-12
 * @purpose:
 * 
 * @version: 1.0
 * 
 * Revision History at the end of file.
 * 
 * Copyright 2017 AcconSys All rights reserved.
 ******************************************************************************/

package com.esoon.cdms.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.swing.DefaultListModel;
import javax.swing.event.ListDataListener;

import com.mentor.chs.api.IXDesign;

public class DesignListModel extends DefaultListModel{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1610726669810041609L;
	private List<DesignModel> designs;

	public DesignListModel(List<DesignModel> designList) {
		this.designs = designList;
	}
	
	@Override
	public int getSize() {
		return this.designs.size();
	}

	@Override
	public Object getElementAt(int index) {
		return designs.get(index);
	}

	@Override
	public void addListDataListener(ListDataListener l) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void removeListDataListener(ListDataListener l) {
		// TODO Auto-generated method stub
		
	}
	
	/**
	 * @param design
	 */
	public void addDesign(DesignModel design) {
		designs.add(design);
	}

	public void addDesigns(Set<DesignModel> designs) {
		this.designs.addAll(designs);
	}
	
	public void addDesign(IXDesign design) {
		designs.add(new DesignModel(design));
	}

}


/*******************************************************************************
 * <B>Revision History</B><BR>
 * [type 'revision' and press Alt + / to insert revision block]<BR>
 * 
 * 
 * 
 * Copyright 2017 AcconSys All rights reserved.
 ******************************************************************************/